<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function f1(num) {
        return new Promise((resolve) => {
            setTimeout(() => {
                resolve(num * num)
            }, 1000)
        })
    }

    const list = [1, 2, 3]

    // 实现异步遍历
    !(async function () {
        for (let i of list) {   // 但是 forEach  不行
            const k = await f1(i)
            console.log(k)
        }
    })()


</script>
</body>
</html>